<!--
 * @Author: JiraiyaChen 979526234@qq.com
 * @Date: 2025-07-17 09:36:00
 * @LastEditors: JiraiyaChen 979526234@qq.com
 * @LastEditTime: 2025-07-17 10:00:12
 * @Description: 通用表格
-->
<template>
  <el-table border :data="tableData" style="width: 100%">
    <el-table-column v-if="showIndex" type="index" label="序号" width="80" align="center" header-align="center" />
    <el-table-column
      v-for="col in columns"
      :key="col.prop"
      :prop="col.prop"
      :label="col.label"
      :width="col.width"
      align="center"
      header-align="center"
    />
  </el-table>
</template>

<script setup lang="ts">
import type { PropType } from 'vue'

const props = defineProps({
  showIndex: {
    type: Boolean,
    default: true
  },
  tableData: {
    type: Array,
    default: () => []
  },
  columns: {
    type: Array as PropType<any[]>,
    default: () => []
  }
})
</script>
